home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Scene Storm
/
Scene Storm - Volume 1.iso
/
coding
/
c
/
jpegagasrc
/
jpegaga
/
pattern.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-11-08
|
1KB
|
63 lines
/* Fill the buffer with file names */
#include <dos/dosasl.h>
#define __NOLIBBASE__
#include <proto/dos.h>
#include <stdio.h>
#include <stdlib.h>
#define MAXFILES 500
extern char *PicArray[];
extern int NumPictures;
extern void FreeASL(void);
void FillNameBuffer(char *pattern)
{
int i;
LONG error;
struct AnchorPath *MyAnchorPath;
MyAnchorPath = calloc(sizeof(struct AnchorPath)+256, 1);
if(MyAnchorPath == NULL)
{
printf("Out of memory!\n");
FreeASL();
exit(10);
}
MyAnchorPath->ap_Strlen = 254;
error = MatchFirst(pattern, MyAnchorPath);
if(error) return;
while(!error)
{
PicArray[NumPictures] = malloc(strlen((char *)&MyAnchorPath->ap_Buf)+1);
if(!PicArray[NumPictures])
{
printf("Out of memory!\n");
MatchEnd(MyAnchorPath);
FreeASL();
exit(10);
}
strcpy(PicArray[NumPictures], MyAnchorPath->ap_Buf);
/* puts(PicArray[NumPictures]); */
NumPictures++;
if(NumPictures == MAXFILES)
{
printf("Too many files!\n");
MatchEnd(MyAnchorPath);
return;
}
error = MatchNext(MyAnchorPath);
}
MatchEnd(MyAnchorPath);
if(MyAnchorPath) free(MyAnchorPath);
}